<template>
    <div>
        <van-nav-bar title="JD购物" />
        <van-search v-model="value" shape="round" placeholder="请输入搜索关键词" @click="dj" />
        <van-tabs v-model:active="active">
            <van-tab title="数码"></van-tab>
            <van-tab title="美妆"></van-tab>
            <van-tab title="零食"></van-tab>
            <van-tab title="生鲜"></van-tab>
        </van-tabs>
        <!-- 轮播图 组件传参 -->
        <van-swipe :autoplay="3000" lazy-render>
            <van-swipe-item v-for="item in swiperdata" :key="image">
                <img :src="item.image_src" style="width: 100%; height: 200px;" />
            </van-swipe-item>
        </van-swipe>
    </div>
</template>

<script setup>
import { swiperdataApi } from '@/api/api';
import router from '@/router';
import { ref } from 'vue';

let swiperdata = ref([])
const images = [
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-1.jpeg',
    'https://fastly.jsdelivr.net/npm/@vant/assets/apple-2.jpeg',
];

swiperdataApi().then(res => {
    console.log('轮播', res);
    swiperdata.value = res.data.message

})
const dj = () => {
    router.push('/sou')
}
</script>

<style lang="scss" scoped></style>